package com.begincode.common.util;

import com.begincode.common.constant.Constant;

/**
 * Created by yangsj on 2016/4/24.
 */
public class ResultUtil {
    private String code;
    private String msg;
    private Object data;

    public static ResultUtil buildSuccess(){
        ResultUtil resultSuccess = new ResultUtil();
        resultSuccess.setCode(Constant.SUCCESS);
        resultSuccess.setMsg(Constant.SUCCESS_DESC);
        return resultSuccess;
    }
    public static ResultUtil buildSuccess(Object data){
        ResultUtil resultSuccess = new ResultUtil();
        resultSuccess.setCode(Constant.SUCCESS);
        resultSuccess.setMsg(Constant.SUCCESS_DESC);
        resultSuccess.setData(data);
        return resultSuccess;
    }
    public static ResultUtil buildFail(){
        ResultUtil resultFail = new ResultUtil();
        resultFail.setCode(Constant.FAIL);
        resultFail.setMsg(Constant.FAIL_DESC);
        return resultFail;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
